// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import VueAxios from 'vue-axios';

//每个vue的组件都可以通过this直接访问$http从而发起ajax请求
import axios from 'axios';
//配置请求根路径  
axios.defaults.baseURL = 'http://127.0.0.1:8888/api/private/v1/'
//预处理请求
axios.interceptors.request.use(config=>{
  console.log(config)
  config.headers.Authorization = window.sessionStorage.getItem('token')
  //最后必须return config
  return config
})
Vue.prototype.$http = axios;


Vue.use(ElementUI)
Vue.config.productionTip = false

/* eslint-disable no-new */
// 
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})
